package com.tarry.shop.user.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * 性别枚举类
 * @author tarry
 * @date 2021-11-23
 */
public enum SexEnum implements IEnum<Integer> {
    MAN(1,"男"),
    WOMAN(2,"女"),
    UNKNOWN(3,"未知");

    private Integer value;
    private String desc;
    SexEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }
    @Override
    public Integer getValue() {
        return this.value;
    }

    /**
     * get方法上加上此注解表示对枚举序列化时返回此字段
     * @return
     */
    @JsonValue
    public String getName() {
        return desc;
    }


    @Override
    public String toString() {
        return this.desc;
    }
}
